/*
 * ExtFieldValueOT.java
 * 
 * $Id: ExtFieldValueOT.java,v 1.2 2009-03-02 15:31:23 mario Exp $
 * 
 * Written by: Mario García García <mario@imagos.es>
 * (c) 2007 Fundación Centro Tecnológico de la Carne
 */
package org.ceteca.explica.core.extTables;

import java.io.Serializable;

/**
 * Store class to hold the data of an extension field's value. 
 * It's an abstract class to define a hierarchy of extension field's values
 * for any type available. All extension field's value classes will implement
 * this superclass.
 * <br/>
 * Responsibilities:
 * <li>
 * 	<ul> Define the store hierarchy for extension field's values. </ul>
 * </li>
 */
public abstract class ExtFieldValueOT implements Serializable {
	/**
	 * Internal Id of the extension field.
	 */
	protected long idExtField;
	/**
	 * Internal Id of the extended item (Id in the original table).
	 */
	protected long idValue;
	
	protected ExtFieldValuePK id;
	
	
	protected Integer version = new Integer(0);
	
	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}
	
	public long getIdExtField() {
		return idExtField;
	}

	public void setIdExtField(long idExtField) {
		this.idExtField = idExtField;
	}

	public long getIdValue() {
		return idValue;
	}

	public void setIdValue(long idValue) {
		this.idValue = idValue;
	}
	
	public ExtFieldValuePK getId() {
		return id;
	}

	public void setId(ExtFieldValuePK id) {
		this.id = id;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final ExtFieldValueOT other = (ExtFieldValueOT) obj;
		return this.getId().equals(other.getId());
	}

	@Override
	public int hashCode() {
		return this.getId().hashCode();
	}

	/**
	 * Returns tag Id assigned to CVS source file.
	 */
	public static String getRevision() {
		return "$Id: ExtFieldValueOT.java,v 1.2 2009-03-02 15:31:23 mario Exp $";
	}
}
